<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>007-HTML5-Canvas-路径-画线</title>
</head>

<body>
    <canvas id="myCanvas" width="200" height="100" style="border:1px solid #d3d3d3;">
        您的浏览器不支持 HTML5 canvas 标签。</canvas>

    <script>

        var c = document.getElementById("myCanvas");
        var ctx = c.getContext("2d");
        // moveTo(x,y) 定义线条开始坐标
        ctx.moveTo(0, 0);
        // lineTo(x,y) 定义线条结束坐标
        ctx.lineTo(200, 100);
        // 绘制线条我们必须使用到 "ink" 的方法，就像stroke().
        ctx.stroke();

    </script>
</body>

</html>